Skip to content

Conversation

marciw
Copy link
Contributor

@marciw marciw commented Jul 24, 2025

Status: ready for PM/engineer review

🚧 not ready for tech writer review

This PR restructures and revises the downsampling section:

  • remove repetitive info and filler
  • apply a more logical structure
  • consolidate methods on one page with tabs
  • edit for clarity, conciseness, and Elastic style (partial)

closes #2239

@marciw

This comment was marked as outdated.

@marciw marciw requested review from a team as code owners August 27, 2025 19:03
@marciw marciw requested a review from yannis-roussos August 27, 2025 19:06
@marciw
Copy link
Contributor Author

marciw commented Aug 27, 2025

@yannis-roussos This is ready for your review, whenever you have a chance. Feel free to add other reviewers. 🙏

(I'll remove the temporary review status markers before merging)

:alt: time series original
:title: Original metrics series
:::
Metrics tools and solutions collect large amounts of time series data over time. As the data ages, it becomes less relevant to the current state of the system. _Downsampling_ lets you reduce the resolution and precision of older data, in exchange for increased storage space.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Metrics tools and solutions collect large amounts of time series data over time. As the data ages, it becomes less relevant to the current state of the system. _Downsampling_ lets you reduce the resolution and precision of older data, in exchange for increased storage space.
Metrics tools and solutions collect large amounts of time series data over time. As the data ages, it becomes less relevant to the current state of the system. _Downsampling_ lets you reduce the resolution and precision of older data, in exchange for decreased storage space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yannis-roussos I'm going to revert this change -- it was syntactically/idiomatically correct as it was. You downsample, and the benefit you get "in exchange for downsampling" is increased storage space. It's a trade-off.

I think the "in exchange for" structure is idiomatic and concise, but we could spell it out more if you prefer:

"Downsampling lets you reduce the resolution and precision of older data, in order to free up storage space."
or
"Downsampling lets you reduce the resolution and precision of older data, in order to also reduce the data's storage footprint."

The last option seems good. WDYT?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marciw OK, I get what you are saying! I agree, the way this is written can confuse people in the same way I got confused. Both proposals look good to me, whichever on you prefer looks good to me!

Copy link

@yannis-roussos yannis-roussos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @marciw, this revamp looks really great! I have added some small comments and pinged Mary to help with an additional review / pair of eyes - her expertise on downsampling will be invaluable to iron out the last few details and move forward!

4. For all other fields, copies the most recent value to the target index.
5. Deletes the original index and replaces it with the downsampled index. Within a data stream, only one index can exist for a time period.

The new, downsampled index is created on the data tier of the original index and inherits the original settings, like number of shards and replicas.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmarouli is this true for ILM? If my understanding is correct, this is only true for downsample actions on the hot phase (coupled with rollover) or for ones with migrate not enabled.

If I am not wrong, can you help with rephrasing this sentence?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is true for ILM.

@yannis-roussos the downsampling action is executed before the migrate action so it happens on the same tier as the original index.

This has caused confusion in the past, but the benefits outweigh the cons:

  • The "hotter" the tier the better the resources it has, the more performant the downsampling would be.
  • Migrate will have less data to "migrate".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Mary, your explanation helps a lot!

Should we add part of it here so that we don't confuse our users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yannis-roussos sorry, what exactly do you want to add here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious to hear what @yannis-roussos has in mind, from me this looks clear enough.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking something more or less like what you explained to me and it immediately made sense:

Suggested change
The new, downsampled index is created on the data tier of the original index and inherits the original settings, like number of shards and replicas.
Downsampling is performed before the migrate action: the new, downsampled index is created on the data tier of the original index and inherits the original settings, like number of shards and replicas.
We do so because the "hotter" tiers have more resources available, and downsampling is executer at a higher speed. That also means that we also have less data to migrate.

Not perfect, but I hope that it provides some clarity on the way I was thinking about this. We can of course skip this suggestion if you think that it is overly descriptive. But if this caused confusion in the past, maybe it is worth noting somewhere

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned that most users do not know about the migrate action, this why just saying that it runs at the tier of the original index feels more helpful to me.

I have some concerns about the second sentence too. It feels like we are defending an implementation detail to our users, trying to say "it might feel weird but it has its benefits". I feel the docs is not the right place for this, if someone has concerns we can always redirect them to the relevant github issue. If we put it in the docs it feels like we are asking for reactions. For example, we do not explain to the users why the downsampling requires the data to be read-only, we just say it does. I think this is similar.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense Mary, let's keep it as is then!

Comment on lines 78 to 85
## Querying downsampled indices [querying-downsampled-indices]

To query a downsampled index, use the [`_search`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) and [`_async_search`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-async-search-submit) endpoints.

* You can query multiple raw data and downsampled indices in a single request, and a single request can include downsampled indices with multiple downsampling intervals (for example, `15m`, `1h`, `1d`).
* When you run queries in {{kib}} and through Elastic solutions, a standard response is returned, with no indication that some of the queried indices are downsampled.
* [Date histogram aggregations](elasticsearch://reference/aggregations/search-aggregations-bucket-datehistogram-aggregation.md) support `fixed_intervals` only (not calendar-aware intervals).
* Time-based histogram aggregations use a uniform bucket size, without regard to the downsampling time interval specified in the request.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to keep the same approach as in the quickstart guide and provide real examples instead of a generic meta discussion on something I have not yet seen as a user

  • You can query multiple raw data and downsampled indices in a single request, and a single request can include downsampled indices with multiple downsampling intervals (for example, 15m, 1h, 1d).
  • When you run queries in {{kib}} and through Elastic solutions, a standard response is returned, with no indication that some of the queried indices are downsampled.

This more or less tells the user that (1) data streams can have multiple downsampling granularities set for them and that (2) you can just query a data stream as usual.

I think that we should:

  • introduce this notion of multiple granularities in different phases with an example first somewhere on a section before this one. (Maybe an additional reason to send this section after a page for setting up / running downsampling?)
    and then
  • just tell the user that they should not worry about downsampling. Querying over multiple downsampling granularities just works and, in general, you will not even get an indication that it is there

@gmarouli could you help with a few ideas on what we could have in this section?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is going a bit deeper than the rest of the document. Can we convey our message with an image? Or list the things that cannot be done with downsampled data?

I am not opposed to examples, but they need to be carefully chosen to be represent the exact cases we want, for example the timezone offset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yannis-roussos @gmarouli Can one of you try to draft the changes you're suggesting or propose some concrete examples? I did create the separate page, so you'll see that the next time you review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multiple granularities were addressed. About the querying, the text is also simpler now, so I am not sure, if we want to continue with examples or not. @yannis-roussos what do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, the new dedicated page for querying downsampled data looks much simple now. Maybe just add a note to link to the TS command once it is ready (as an update included in elastic/elasticsearch#134373)?


Before you start, make sure your index is a candidate for downsampling:

* The index must be **read-only**. You can roll over a write index and make it read-only.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only true for running downsampling manually ("Downsampling with the API" tab). ILM and DLM will take care of this on behalf of the user.

Am I right @gmarouli?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I am not sure if we want to get into the manual downsampling that much outside of the dedicated example (and even that one feels like to much to me on the old docs).

I propose to be opinionated and just stick to the happy path / what we propose: Today it is ILM (I guess) and we can change that to DLM once we have tiers supported.

I propose this to move under the "Downsampling with the API" tab

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add a little bit more info on what are the upsides / downsides of each method - everything that we have been talking about on the incremental downsampling docs @gmarouli but are not included anywhere in the canonical docs for the current downsampling. Like that we can only have as many actions as phases in ILM or the fact that we have a higher limit on DLM but no ability to move between tiers.

What do you think @gmarouli?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @yannis-roussos in most comments. But it's not so simple either.

To start with, I think we need to agree about the scope of this page. Is it to guide the user on how to downsample their time series data streams or how to downsample a single index. These two things are not equivalent.

  • Downsampling a single read-only index means just execute the downsampling API and you get a new index, now you have two indices the original and the downsampled one. But effectively you have downsampled the index, what you want to do with that is up to the user. I would ONLY recommend this for experimentation, if a user wants to see how downsampled data look like, I would suggest that they do that and they play with the downsampled index.
  • On the other hand, downsampling a data stream with ILM or data stream lifecycle, has many other steps such as waiting for the end time of a backing index to pass, making the index read-only, executing the downsampling, replacing the original backing index with the new one and then deleting the original one. Yes, the downsampling operation is executed on the backing indices but there are other actions that happen on the data stream.

My recommendation/preference is:

  • The scope of this doc is downsampling time series data streams.
  • We should mention that downsampling requires the data to be read-only, so when a time range is downsampled it cannot process any more updates.
  • We only talk about data stream lifecycle and ILM. We can start with a sentence to help them choose which one to look at, for example, "serverless only look at data stream lifecycle, if you need tiers in stack look at ILM. If you do not need tiers consider using data stream lifecycle because it supports more downsampling rounds".
  • We start with data stream lifecycle and we show only the lifecycle configuration not the whole composable index template, this feels more comparable to the ILM policy.
  • We finally go through ILM.

What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Mary's proposal and I ++ the fact that this is about downsampling time series data streams. Downsampling a stand alone index is an advanced operation that is not part of the path that we want to guide users towards.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to address some of this, but please take another look -- not sure I'm following your comments.

marciw and others added 2 commits September 8, 2025 21:02
Co-authored-by: Yannis Roussos <[email protected]>
Co-authored-by: Yannis Roussos <[email protected]>
@marciw

This comment was marked as outdated.

gmarouli

This comment was marked as outdated.

@marciw
Copy link
Contributor Author

marciw commented Sep 15, 2025

@yannis-roussos @gmarouli I've addressed most of your comments and asked for clarification on a few others. Please take another look when you have time. 🙏

Also note that this is just one piece of the overall restructuring -- additional PRs coming soon

@marciw
Copy link
Contributor Author

marciw commented Sep 15, 2025

for easy access, here's the link to the preview page -- you can start here and use the "next" link at the bottom of each page https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/2274/manage-data/data-store/data-streams/downsampling-time-series-data-stream

Copy link
Contributor

@gmarouli gmarouli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @marciw , I added some small comments but I am very happy with how it looks, thank you!


1. Creates a new document for each group of documents with matching `_tsid` values (time series dimension fields), grouped into buckets that correspond to timestamps in a specific interval.

For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. All documents within aa given hour interval are summarized and stored as a single document in the downsampled index.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. All documents within aa given hour interval are summarized and stored as a single document in the downsampled index.
For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. All documents within a given hour interval are summarized and stored as a single document in the downsampled index.

4. For all other fields, copies the most recent value to the target index.
5. Deletes the original index and replaces it with the downsampled index. Within a data stream, only one index can exist for a time period.

The new, downsampled index is created on the data tier of the original index and inherits the original settings, like number of shards and replicas.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious to hear what @yannis-roussos has in mind, from me this looks clear enough.

To downsample a time series via a data stream lifecycle, add a [downsampling](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-lifecycle) section to the lifecycle.

* Set `fixed_interval` to your preferred level of granularity. The original time series data will be aggregated at this interval.
* Set `after` to the minimum time to wait after an index rollover, before running downsampling.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marciw do you think we should mention here also that the index time series end time will be respected?

serverless: ga
```

To downsample a time series via a data stream lifecycle, add a [downsampling](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-lifecycle) section to the lifecycle.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention here that a user can add it to the index template but it will work for new data streams only?

Suggested change
To downsample a time series via a data stream lifecycle, add a [downsampling](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-lifecycle) section to the lifecycle.
To downsample a time series via a data stream lifecycle, add a [downsampling](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-lifecycle) section to the lifecycle directly to an existing data stream or to an index template for new data streams only.

Copy link

@yannis-roussos yannis-roussos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @marciw, looks great! I agree with Mary that this looks ready for prime time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate and restructure downsampling section
3 participants